import request from '@/utils/request'

// 班级信息
// 渲染页面
export function getClassApi(params) {
  return request({
    url: '/class/class',
    method: 'get',
    params
  })
}

// 是否显示开关
export function getSwitchApi(data) {
  return request({
    url: `/class/class/${data.id}`,
    method: 'put',
    data
  })
}

// 学科
export function getSubjectApi() {
  return request({
    url: '/subject/tree',
    method: 'get'
  })
}
// 授课老师
export function getTeacherApi(params) {
  return request({
    url: '/class/teacher',
    method: 'get',
    params
  })
}

// 添加
export function addClassApi(data) {
  return request({
    url: '/class/class',
    method: 'post',
    data
  })
}
// 删除
export function delClassApi(id) {
  return request({
    url: `/class/class/${id}`,
    method: 'delete'
  })
}

// 数据回显
export function showClassApi(id) {
  return request({
    url: `/class/class/${id}`,
    method: 'get'
  })
}

// 修改
export function editClassApi(data) {
  return request({
    url: `/class/class/${data.id}`,
    method: 'put',
    data
  })
}

// 学生信息
// 渲染页面
export function getStudentsApi(params) {
  return request({
    url: '/class/student',
    method: 'get',
    params
  })
}

// 归属班级
export function getClassesApi() {
  return request({
    url: '/class/class',
    method: 'get'
  })
}
// 增加
export function addStudentsApi(data) {
  return request({
    url: '/class/student',
    method: 'post',
    data
  })
}

// 删除
export function delStudentsApi(data) {
  return request({
    url: `/class/student`,
    method: 'delete',
    data
  })
}

// 数据回显
export function showStudentsApi(id) {
  return request({
    url: `/class/student/${id}`,
    method: 'get'
  })
}

// 修改
export function editStudentsApi(data) {
  return request({
    url: `/class/student/${data.id}`,
    method: 'put',
    data
  })
}
